package cn.ym.aircraft;

import javax.swing.*;
import java.awt.image.BufferedImage;

public class Airplane extends FlyingObject implements EnemyScore{
    Airplane() {
        super(48, 50);
        this.speed = 4;
    }

    public void step() {
        this.y += this.speed;
    }

    private int index = 1;

    @Override
    public BufferedImage getImage() {
        if (isLive()) {
            return Images.airs[0];
        } else if (isDead()) {
            BufferedImage img = Images.airs[index++];
            if (index == Images.airs.length) {
                state = REMOVE;
            }
            return img;
        }
        return null;
    }


    @Override
    public int getScore() {
        return 10;
    }
}
